<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
    var reg=/\d{3,6}/g;
    var reg01=/\d{2}/g;
    var reg02=/\d{1,}/g;
    var str="24652jfiwegj15";
    console.log(str.replace(reg,"*"));
    console.log(str.replace(reg01,"*"));
    console.log(str.replace(reg02,"*"));
    </script>
</body>
</html>